<template>
  <div id="app">
    <Index />
    <BaseMap />
    <Aside @chooseIcon="chooseIcon" />
    <AsidePanel ref="tree" :showArrys="[ICons.TuCengShow]" />
    <!-- <Input :showArrys="[ICons.NameShow]"/> -->
    <FileQuery :showArrys="[ICons.SouSuoShow]" />
    <AddressQuery :showArrys="[ICons.NameShow]" />
    <Measure :showArrys="[ICons.CeLiangShow]" />
  </div>
</template>

<script>
import axios from "axios";
import Index from "./index";
import BaseMap from "./components/baseMap";
import Aside from "./components/aside";
import AsidePanel from "./components/asidePanel";
import Input from "./components/input";
import FileQuery from "./components/fileQuery";
import AddressQuery from "./components/addressQuery";
import Measure from "./components/measure";
import {
  mapZoomOut,
  mapZoomIn,
  mapGoTo,
  changeImageLayer,
  removeAllLayers
} from "./map/mapHandle";
import { tileLayerConfig, PropData, productorIP } from "./map/mapconfig";
export default {
  name: "App",
  components: {
    Index,
    BaseMap,
    Aside,
    AsidePanel,
    Input,
    FileQuery,
    AddressQuery,
    Measure
  },
  data() {
    return {
      ICons: {
        TuCengShow: false,
        FangDaShow: false,
        SuoXiaoShow: false,
        SouSuoShow: false,
        TuCengChaXunShow: false,
        CeLiangShow: false,
        DingWeiShow: false,
        NameShow: false
      }
    };
  },
  methods: {
    chooseIcon(type) {
      switch (type) {
        case "图层":
          this.ICons.TuCengShow = !this.ICons.TuCengShow;
          break;
        case "放大":
          mapZoomIn();
          // this.ICons.FangDaShow = !this.ICons.FangDaShow;
          break;
        case "缩小":
          mapZoomOut();
          // this.ICons.SuoXiaoShow = !this.ICons.SuoXiaoShow;
          break;
        case "搜索":
          this.ICons.SouSuoShow = !this.ICons.SouSuoShow;
          break;
        case "图层查询":
          this.ICons.TuCengChaXunShow = !this.ICons.TuCengChaXunShow;
          break;
        case "测量":
          this.ICons.CeLiangShow = !this.ICons.CeLiangShow;
          break;
        case "地名地址定位":
          this.ICons.NameShow = !this.ICons.NameShow;
          if (!this.ICons.NameShow) {
            window["pointGraphic"].forEach(item => {
              window["view"].graphics.remove(item);
            });
          }
          //nameLocation();
          break;
        case "首页":
          this.location();
          window["view"].graphics.remove(window.polylineGraphic);
          window["pointGraphic"].forEach(item => {
            window["view"].graphics.remove(item);
          });
          // window['view'].graphics.remove(window['pointGraphic']);
          break;
        default:
          console.log("error!");
          break;
      }
    },
    //定位
    location() {
      //默认视角
      mapGoTo(-8017.253757247714, -3058.227434702489,2);
      //默认图层
      removeAllLayers();
      changeImageLayer();
    }
  }
};
</script>

<style>
.esri-view-surface.esri-view-surface--inset-outline::after {
  outline: none !important;
}
</style>
